package Form;

import java.awt.Color;
import java.awt.Component;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.Insets;
import java.awt.SystemColor;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.File;
import java.util.ArrayList;

import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSpinner;
import javax.swing.JTabbedPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.SpinnerNumberModel;
import javax.swing.SwingConstants;
import javax.swing.UIManager;
import javax.swing.border.MatteBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;

import org.eclipse.wb.swing.FocusTraversalOnArray;

import say.swing.JFontChooser;
import Control.Shop_Customization_Control;
import Entity.Shop_Product;

public class Shop_Customization_Form extends JDialog {

	/**
	 * 
	 */
	private static final long serialVersionUID = -3631928036211571959L;
	
	//Class attributes, clear when close customization
	private ArrayList <Shop_Customization_PictureSettings> templateAllIcons = new ArrayList <Shop_Customization_PictureSettings> ();
	public static boolean moveFrontCustomization = false;
	public static boolean moveBackCustomization = false;
	public static boolean moveFrontTextCustomization = false;
	public static boolean moveBackTextCustomization = false;
	public static Shop_Customization_PictureSettings customizationToMove;
	public static Shop_Customization_TextSettings textCustomizationToMove;
	public static Shop_Customization_Form self;
	
	//Initialize controller
	private Shop_Customization_Control control = new Shop_Customization_Control();
	
	//Object attributes
	private Shop_Product product;
	private Image defaultProductFrontImage, defaultProductBackImage;
	private Shop_Customization_PictureSettings defaultProductFront, defaultProductBack;
	private Image customImage;
	private Shop_Customization_PictureSettings customDesign;
	private Shop_Product_Form parser;
	private Shop_Product_Search_Form secondaryParser;
	private Shop_Customization_Form formForDispose;
	
	//Instantiate JComponenets
	private JTabbedPane preview;
	private JTabbedPane edits;
	private JPanel buttons;
	private JPanel editsHistory;
	private JPanel templates;
	private JPanel details;
	private JPanel personalize;
	private JScrollPane frontEditsHistory;
	private JScrollPane backEditsHistory;
	private Shop_Customization_Canvas frontView; //Canvas for front
	private Shop_Customization_Canvas backView;  //Canvas for back
	private JPanel frontHolder;
	private JPanel backHolder;
	private JScrollPane templatesIcons;
	private JLabel btnConfirm;
	private JLabel btnReset;
	private JPanel panelForConfirm;
	private JPanel panelForReset;
	private JLabel lblText;
	private JFontChooser fontChooser;
	private JButton btnFont;
	private JScrollPane scrollPane;
	private JTextArea textArea;
	private JLabel lblCustomImage;
	private JButton btnUploadImage;
	private JFileChooser fileChooser;
	private JLabel customImageDesign;
	private JButton addImageToCanvas;
	private JButton addTextToCanvas;
	private JLabel lblCatalog;
	private JLabel lblProdname;
	private JTextArea txtrDescription;
	private JLabel lblTotalPrice;
	private JLabel lblPrice;
	private JSpinner quantity;
	private JLabel lblQuantity;
	
	//User-defined methods
	
	public void refreshCanvas(){
		frontView.repaint();
		backView.repaint();
	}
	
	public void refreshEditHistory(){
		remove(getEditsHistory());
		
		editsHistory = null;
		frontEditsHistory = null;
		backEditsHistory = null;
		
		GridBagConstraints gbc_editsHistory = new GridBagConstraints();
		gbc_editsHistory.anchor = GridBagConstraints.NORTH;
		gbc_editsHistory.insets = new Insets(0, 5, 5, 5);
		gbc_editsHistory.weighty = 0.1;
		gbc_editsHistory.weightx = 0.5;
		gbc_editsHistory.fill = GridBagConstraints.BOTH;
		gbc_editsHistory.gridx = 0;
		gbc_editsHistory.gridy = 1;
		getContentPane().add(getEditsHistory(), gbc_editsHistory);
		
		validate();
		repaint();
	}
	
	//Getter and Setter
	
	public Shop_Customization_Control getControl() {
		return control;
	}

	public Shop_Customization_PictureSettings getCustomDesign() {
		return customDesign;
	}

	public void setCustomDesign(Shop_Customization_PictureSettings customDesign) {
		this.customDesign = customDesign;
	}

	public Shop_Product getProduct() {
		return product;
	}

	public void setProduct(Shop_Product product) {
		this.product = product;
	}

	//The page
	
	/**
	 * @return the parser
	 */
	public Shop_Product_Form getParser() {
		return parser;
	}

	/**
	 * @param parser the parser to set
	 */
	public void setParser(Shop_Product_Form parser) {
		this.parser = parser;
	}

	public Shop_Product_Search_Form getSecondaryParser() {
		return secondaryParser;
	}

	public void setSecondaryParser(Shop_Product_Search_Form secondaryParser) {
		this.secondaryParser = secondaryParser;
	}

	public Shop_Customization_Form(JFrame frame, Shop_Product_Search_Form parser, boolean modal,Shop_Product product){
		super(frame, modal);
		this.setSecondaryParser(parser);
		formForDispose = this;
		self = this;
		this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
		this.initComponents(product);
		this.pack();
		this.setLocationRelativeTo(frame);
		setFocusTraversalPolicy(new FocusTraversalOnArray(new Component[]{getEdits(), getDetails(), getTemplates(), getPersonalize(), getPreview(), getFrontView(), getEditsHistory(), getButtons()}));
		this.setVisible(true);
	}

	/**
	 * @wbp.parser.constructor
	 */
	public Shop_Customization_Form(JFrame frame, Shop_Product_Form parser, boolean modal,Shop_Product product){
		super(frame, modal);
		this.setParser(parser);
		formForDispose = this;
		self = this;
		this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
		this.initComponents(product);
		this.pack();
		this.setLocationRelativeTo(frame);
		setFocusTraversalPolicy(new FocusTraversalOnArray(new Component[]{getEdits(), getDetails(), getTemplates(), getPersonalize(), getPreview(), getFrontView(), getEditsHistory(), getButtons()}));
		this.setVisible(true);
	}
	
	public void initComponents(Shop_Product product){
		
		this.setProduct(product);
		
		GridBagLayout gridBagLayout = new GridBagLayout();
		gridBagLayout.columnWidths = new int[]{0, 0, 0};
		gridBagLayout.rowHeights = new int[]{0, 0, 0, 0};
		gridBagLayout.columnWeights = new double[]{1.0, 1.0, Double.MIN_VALUE};
		gridBagLayout.rowWeights = new double[]{1.0, 1.0, 1.0, Double.MIN_VALUE};
		getContentPane().setLayout(gridBagLayout);
		setBackground(Color.GRAY);
		//Adding of JComponents to ContentPane
		GridBagConstraints gbc_edits = new GridBagConstraints();
		gbc_edits.insets = new Insets(5, 5, 5, 5);
		gbc_edits.weighty = 1.0;
		gbc_edits.weightx = 1.0;
		gbc_edits.fill = GridBagConstraints.BOTH;
		gbc_edits.gridx = 0;
		gbc_edits.gridy = 0;
		getContentPane().add(getEdits(), gbc_edits);
		GridBagConstraints gbc_preview = new GridBagConstraints();
		gbc_preview.insets = new Insets(5, 0, 5, 5);
		gbc_preview.ipady = 3;
		gbc_preview.ipadx = 3;
		gbc_preview.weighty = 1.0;
		gbc_preview.weightx = 1.0;
		gbc_preview.gridheight = 3;
		gbc_preview.fill = GridBagConstraints.BOTH;
		gbc_preview.gridx = 1;
		gbc_preview.gridy = 0;
		getContentPane().add(getPreview(), gbc_preview);
		GridBagConstraints gbc_editsHistory = new GridBagConstraints();
		gbc_editsHistory.anchor = GridBagConstraints.NORTH;
		gbc_editsHistory.insets = new Insets(0, 5, 5, 5);
		gbc_editsHistory.weighty = 0.1;
		gbc_editsHistory.weightx = 0.5;
		gbc_editsHistory.fill = GridBagConstraints.BOTH;
		gbc_editsHistory.gridx = 0;
		gbc_editsHistory.gridy = 1;
		getContentPane().add(getEditsHistory(), gbc_editsHistory);
		GridBagConstraints gbc_buttons = new GridBagConstraints();
		gbc_buttons.insets = new Insets(0, 5, 0, 5);
		gbc_buttons.weighty = 1.0;
		gbc_buttons.weightx = 1.0;
		gbc_buttons.fill = GridBagConstraints.BOTH;
		gbc_buttons.gridx = 0;
		gbc_buttons.gridy = 2;
		getContentPane().add(getButtons(), gbc_buttons);
		
	}

	private JTabbedPane getPreview() {
		if (preview == null) {
			preview = new JTabbedPane(JTabbedPane.TOP);
			preview.setPreferredSize(new Dimension(420, 600));
			preview.addTab("Front View", null, getFrontHolder(), null);
			preview.addTab("Back View", null, getBackHolder(), null);
			preview.addChangeListener(new ChangeListener(){

				@Override
				public void stateChanged(ChangeEvent arg0) {

					moveFrontCustomization = false;
					moveBackCustomization = false;
					
				}
				
			});
		}
		return preview;
	}
	private JTabbedPane getEdits() {
		if (edits == null) {
			edits = new JTabbedPane(JTabbedPane.TOP);
			edits.setSelectedIndex(-1);
			edits.setPreferredSize(new Dimension(600, 250));
			edits.addTab("Templates", null, getTemplates(), null);
			edits.addTab("Personalize", null, getPersonalize(), null);
			edits.addTab("Details", null, getDetails(), null);
		}
		return edits;
	}
	private JPanel getButtons() {
		if (buttons == null) {
			buttons = new JPanel();
			buttons.setOpaque(false);
			buttons.setLayout(new GridLayout(1, 2, 0, 0));
			buttons.add(getPanelForConfirm());
			buttons.add(getPanelForReset());
		}
		return buttons;
	}
	private JPanel getEditsHistory() {
		if (editsHistory == null) {
			editsHistory = new JPanel();
			editsHistory.setOpaque(false);
			editsHistory.setPreferredSize(new Dimension(600, 250));
			GridBagLayout gbl_editsHistory = new GridBagLayout();
			gbl_editsHistory.columnWidths = new int[]{113, 113, 0};
			gbl_editsHistory.rowHeights = new int[]{89, 0};
			gbl_editsHistory.columnWeights = new double[]{1.0, 1.0, Double.MIN_VALUE};
			gbl_editsHistory.rowWeights = new double[]{0.0, Double.MIN_VALUE};
			editsHistory.setLayout(gbl_editsHistory);
			GridBagConstraints gbc_frontEditsHistory = new GridBagConstraints();
			gbc_frontEditsHistory.weighty = 1.0;
			gbc_frontEditsHistory.weightx = 1.0;
			gbc_frontEditsHistory.insets = new Insets(0, 0, 0, 5);
			gbc_frontEditsHistory.fill = GridBagConstraints.BOTH;
			gbc_frontEditsHistory.gridx = 0;
			gbc_frontEditsHistory.gridy = 0;
			editsHistory.add(getFrontEditsHistory(), gbc_frontEditsHistory);
			GridBagConstraints gbc_backEditsHistory = new GridBagConstraints();
			gbc_backEditsHistory.weighty = 1.0;
			gbc_backEditsHistory.weightx = 1.0;
			gbc_backEditsHistory.fill = GridBagConstraints.BOTH;
			gbc_backEditsHistory.gridx = 1;
			gbc_backEditsHistory.gridy = 0;
			editsHistory.add(getBackEditsHistory(), gbc_backEditsHistory);
		}
		return editsHistory;
	}
	private JPanel getTemplates() {
		if (templates == null) {
			templates = new JPanel();
			templates.setBackground(Color.DARK_GRAY);
			templates.setLayout(new GridLayout(0, 1, 0, 0));
			templates.add(getTemplatesIcons());
		}
		return templates;
	}
	private JScrollPane getTemplatesIcons() {
		if (templatesIcons == null) {
			//Get all template images
			File [] templatesAll = new File("Resources/Images/Templates").listFiles();
			for(int i = 0; i < templatesAll.length; i++)
				templateAllIcons.add(new Shop_Customization_PictureSettings(Toolkit.getDefaultToolkit().createImage(templatesAll[i].getAbsolutePath()), 420, 550));
			
			//Calculate number of rows
			int rows = 0;
			if(templateAllIcons.size() != 0)
				rows++;
			rows += templateAllIcons.size() / 5;
			
			//Panel holding all templates
			JPanel templatesAllHolder = new JPanel();
			templatesAllHolder.setBackground(Color.DARK_GRAY);
			templatesAllHolder.setLayout(new GridLayout(0, 5));
			templatesAllHolder.setPreferredSize(new Dimension(570, (rows * 106)));
			
			//Adding all templates into templatesAllHolder
			for(int i = 0; i < templateAllIcons.size(); i++){
				
				//Create single template icon
				final JLabel template = new JLabel();
				template.setBackground(Color.GRAY);
				template.setBorder(BorderFactory.createLineBorder(SystemColor.DARK_GRAY, 3));
				template.setOpaque(true);
				
				final Shop_Customization_PictureSettings templateIcon = templateAllIcons.get(i);
				template.setIcon(new ImageIcon(templateIcon.getDesign().getScaledInstance(templateIcon.getWidth(), templateIcon.getHeight(), Image.SCALE_DEFAULT)));
				
				template.addMouseListener(new MouseListener(){

					@Override
					public void mouseClicked(MouseEvent e) {
						
						if(getPreview().getSelectedIndex() == 0)
							frontView.addCustomization(templateIcon);
						else
							backView.addCustomization(templateIcon);
						
						refreshCanvas();
						
						refreshEditHistory();
						
						
					}

					@Override
					public void mouseEntered(MouseEvent e) {
						
						template.setBackground(Color.LIGHT_GRAY);
						
					}

					@Override
					public void mouseExited(MouseEvent e) {
						
						template.setBackground(Color.GRAY);
						
					}

					@Override
					public void mousePressed(MouseEvent e) {
						// TODO Auto-generated method stub
						
					}

					@Override
					public void mouseReleased(MouseEvent e) {
						
						refreshCanvas();
						
					}
					
				});
				
				templatesAllHolder.add(template);
				
			}
			
			templatesIcons = new JScrollPane(templatesAllHolder);
		}
		return templatesIcons;
	}
	private JPanel getDetails() {
		if (details == null) {
			details = new JPanel();
			details.setBackground(Color.DARK_GRAY);
			GridBagLayout gbl_details = new GridBagLayout();
			gbl_details.columnWidths = new int[]{0, 0, 0, 84, 113, 132, 14, 0};
			gbl_details.rowHeights = new int[]{0, 0, 0, 126, 8, 0};
			gbl_details.columnWeights = new double[]{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE};
			gbl_details.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE};
			details.setLayout(gbl_details);
			GridBagConstraints gbc_lblCatalog = new GridBagConstraints();
			gbc_lblCatalog.fill = GridBagConstraints.BOTH;
			gbc_lblCatalog.insets = new Insets(10, 10, 5, 5);
			gbc_lblCatalog.anchor = GridBagConstraints.NORTHWEST;
			gbc_lblCatalog.gridx = 1;
			gbc_lblCatalog.gridy = 0;
			details.add(getLblCatalog(), gbc_lblCatalog);
			GridBagConstraints gbc_lblQuantity = new GridBagConstraints();
			gbc_lblQuantity.fill = GridBagConstraints.BOTH;
			gbc_lblQuantity.gridheight = 2;
			gbc_lblQuantity.insets = new Insets(5, 15, 5, 5);
			gbc_lblQuantity.gridx = 4;
			gbc_lblQuantity.gridy = 1;
			details.add(getLblQuantity(), gbc_lblQuantity);
			GridBagConstraints gbc_quantity = new GridBagConstraints();
			gbc_quantity.fill = GridBagConstraints.BOTH;
			gbc_quantity.insets = new Insets(5, 15, 5, 5);
			gbc_quantity.gridx = 4;
			gbc_quantity.gridy = 3;
			details.add(getQuantity(), gbc_quantity);
			GridBagConstraints gbc_lblTotalPrice = new GridBagConstraints();
			gbc_lblTotalPrice.gridheight = 2;
			gbc_lblTotalPrice.fill = GridBagConstraints.BOTH;
			gbc_lblTotalPrice.insets = new Insets(5, 0, 5, 5);
			gbc_lblTotalPrice.gridx = 5;
			gbc_lblTotalPrice.gridy = 1;
			details.add(getLblTotalPrice(), gbc_lblTotalPrice);
			GridBagConstraints gbc_lblProdname = new GridBagConstraints();
			gbc_lblProdname.gridheight = 2;
			gbc_lblProdname.gridwidth = 3;
			gbc_lblProdname.insets = new Insets(5, 5, 5, 5);
			gbc_lblProdname.anchor = GridBagConstraints.NORTHWEST;
			gbc_lblProdname.fill = GridBagConstraints.BOTH;
			gbc_lblProdname.gridx = 1;
			gbc_lblProdname.gridy = 1;
			details.add(getLblProdname(), gbc_lblProdname);
			GridBagConstraints gbc_lblPrice = new GridBagConstraints();
			gbc_lblPrice.fill = GridBagConstraints.BOTH;
			gbc_lblPrice.insets = new Insets(5, 0, 5, 5);
			gbc_lblPrice.gridx = 5;
			gbc_lblPrice.gridy = 3;
			details.add(getLblPrice(), gbc_lblPrice);
			GridBagConstraints gbc_txtrDescription = new GridBagConstraints();
			gbc_txtrDescription.gridwidth = 3;
			gbc_txtrDescription.insets = new Insets(0, 5, 5, 5);
			gbc_txtrDescription.fill = GridBagConstraints.BOTH;
			gbc_txtrDescription.gridx = 1;
			gbc_txtrDescription.gridy = 3;
			details.add(getTxtrDescription(), gbc_txtrDescription);
		}
		return details;
	}
	private JPanel getPersonalize() {
		if (personalize == null) {
			personalize = new JPanel();
			personalize.setBackground(Color.DARK_GRAY);
			GridBagLayout gbl_personalize = new GridBagLayout();
			gbl_personalize.columnWidths = new int[] {0, 50, 50, 50, 50, 50, 50, 50, 0, 0};
			gbl_personalize.rowHeights = new int[]{0, 0, 0, 59};
			gbl_personalize.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
			gbl_personalize.rowWeights = new double[]{0.0, 0.0, 0.0, Double.MIN_VALUE};
			personalize.setLayout(gbl_personalize);
			GridBagConstraints gbc_lblText = new GridBagConstraints();
			gbc_lblText.anchor = GridBagConstraints.NORTHEAST;
			gbc_lblText.insets = new Insets(12, 12, 5, 5);
			gbc_lblText.gridx = 0;
			gbc_lblText.gridy = 0;
			personalize.add(getLblText(), gbc_lblText);
			GridBagConstraints gbc_scrollPane = new GridBagConstraints();
			gbc_scrollPane.gridheight = 2;
			gbc_scrollPane.ipady = 70;
			gbc_scrollPane.anchor = GridBagConstraints.NORTH;
			gbc_scrollPane.gridwidth = 7;
			gbc_scrollPane.insets = new Insets(10, 0, 10, 5);
			gbc_scrollPane.fill = GridBagConstraints.HORIZONTAL;
			gbc_scrollPane.gridx = 1;
			gbc_scrollPane.gridy = 0;
			personalize.add(getScrollPane(), gbc_scrollPane);
			GridBagConstraints gbc_btnFont = new GridBagConstraints();
			gbc_btnFont.anchor = GridBagConstraints.NORTHWEST;
			gbc_btnFont.insets = new Insets(10, 0, 5, 0);
			gbc_btnFont.gridx = 8;
			gbc_btnFont.gridy = 0;
			personalize.add(getBtnFont(), gbc_btnFont);
			GridBagConstraints gbc_addTextToCanvas = new GridBagConstraints();
			gbc_addTextToCanvas.anchor = GridBagConstraints.NORTHWEST;
			gbc_addTextToCanvas.insets = new Insets(0, 0, 5, 0);
			gbc_addTextToCanvas.gridx = 8;
			gbc_addTextToCanvas.gridy = 1;
			personalize.add(getAddTextToCanvas(), gbc_addTextToCanvas);
			GridBagConstraints gbc_lblCustomImage = new GridBagConstraints();
			gbc_lblCustomImage.anchor = GridBagConstraints.NORTHEAST;
			gbc_lblCustomImage.insets = new Insets(0, 0, 5, 5);
			gbc_lblCustomImage.gridx = 0;
			gbc_lblCustomImage.gridy = 2;
			personalize.add(getLblCustomImage(), gbc_lblCustomImage);
			GridBagConstraints gbc_customImageDesign = new GridBagConstraints();
			gbc_customImageDesign.gridwidth = 2;
			gbc_customImageDesign.gridheight = 2;
			gbc_customImageDesign.fill = GridBagConstraints.BOTH;
			gbc_customImageDesign.anchor = GridBagConstraints.NORTHWEST;
			gbc_customImageDesign.insets = new Insets(0, 0, 10, 5);
			gbc_customImageDesign.gridx = 1;
			gbc_customImageDesign.gridy = 2;
			personalize.add(getCustomImageDesign(), gbc_customImageDesign);
			GridBagConstraints gbc_btnUploadImage = new GridBagConstraints();
			gbc_btnUploadImage.anchor = GridBagConstraints.NORTHWEST;
			gbc_btnUploadImage.insets = new Insets(0, 0, 5, 5);
			gbc_btnUploadImage.gridx = 3;
			gbc_btnUploadImage.gridy = 2;
			personalize.add(getBtnUploadImage(), gbc_btnUploadImage);
			GridBagConstraints gbc_addImageToCanvas = new GridBagConstraints();
			gbc_addImageToCanvas.anchor = GridBagConstraints.NORTHWEST;
			gbc_addImageToCanvas.insets = new Insets(0, 0, 0, 5);
			gbc_addImageToCanvas.gridx = 3;
			gbc_addImageToCanvas.gridy = 3;
			personalize.add(getAddImageToCanvas(), gbc_addImageToCanvas);
		}
		return personalize;
	}
	private JScrollPane getFrontEditsHistory() {
		if (frontEditsHistory == null) {
			
			//Panel for front customizations
			final ArrayList <Shop_Customization_PictureSettings> frontCustomizationsArr = frontView.getCustomizations();
			int noFrontCustomizations = frontCustomizationsArr.size();
			
			final ArrayList <Shop_Customization_TextSettings> frontTextCustomizationsArr = frontView.getTextCustomizations();
			int noFrontTextCustomizations = frontTextCustomizationsArr.size();
			
			//Panel containing all front customizations
			JPanel frontCustomizations = new JPanel();
			frontCustomizations.setBackground(Color.DARK_GRAY);
			frontCustomizations.setPreferredSize(new Dimension(230, ((noFrontCustomizations - 1) * 57) + ((noFrontTextCustomizations * 57) + 15)));
			
			JLabel header = new JLabel("Front History");
			header.setForeground(Color.LIGHT_GRAY);
			header.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 15));
			frontCustomizations.add(header);
			
			//Generate front customizations
			for(int i = 0; i < noFrontTextCustomizations; i++){
				//Panel for each customization
				final JPanel textCustomization = new JPanel();
				final JTextField textHolder = new JTextField();
				textCustomization.setLayout(new GridLayout(1, 3));
				textCustomization.setBackground(Color.GRAY);
				textCustomization.setBorder(BorderFactory.createMatteBorder(3, 3, 3, 3, Color.DARK_GRAY));
				textCustomization.setPreferredSize(new Dimension(230, 50));
				textCustomization.addMouseListener(new MouseListener(){

					@Override
					public void mouseClicked(MouseEvent e) {
						// TODO Auto-generated method stub
						
					}

					@Override
					public void mouseEntered(MouseEvent e) {
						if(preview.getSelectedIndex() == 0){
							textHolder.setBorder(BorderFactory.createLineBorder(SystemColor.LIGHT_GRAY, 5));
							textCustomization.setBackground(Color.LIGHT_GRAY);
						}
						
					}

					@Override
					public void mouseExited(MouseEvent e) {
						textHolder.setBorder(BorderFactory.createLineBorder(SystemColor.GRAY, 5));
						textCustomization.setBackground(Color.GRAY);
						
					}

					@Override
					public void mousePressed(MouseEvent e) {
						// TODO Auto-generated method stub
						
					}

					@Override
					public void mouseReleased(MouseEvent e) {
						// TODO Auto-generated method stub
						
					}
					
				});
				
				//Get text customization
				final Shop_Customization_TextSettings text = frontTextCustomizationsArr.get(i);
				
				//Label for text
				textHolder.setText(text.getText());
				textHolder.setBorder(BorderFactory.createLineBorder(SystemColor.GRAY, 5));
				textHolder.setFont(text.getFont());
				textHolder.addMouseListener(new MouseListener(){

					@Override
					public void mouseClicked(MouseEvent arg0) {
						// TODO Auto-generated method stub
						
					}

					@Override
					public void mouseEntered(MouseEvent arg0) {
						if(preview.getSelectedIndex() == 0){
							textHolder.setEnabled(true);
							textHolder.setBorder(BorderFactory.createLineBorder(SystemColor.LIGHT_GRAY, 5));
							textCustomization.setBackground(Color.LIGHT_GRAY);
						}
						else
							textHolder.setEnabled(false);
					}

					@Override
					public void mouseExited(MouseEvent arg0) {
						textHolder.setBorder(BorderFactory.createLineBorder(SystemColor.GRAY, 5));
						textCustomization.setBackground(Color.GRAY);
					}

					@Override
					public void mousePressed(MouseEvent arg0) {
						// TODO Auto-generated method stub
						
					}

					@Override
					public void mouseReleased(MouseEvent arg0) {
						// TODO Auto-generated method stub
						
					}
					
				});
				textHolder.getDocument().addDocumentListener(new DocumentListener(){

					@Override
					public void changedUpdate(DocumentEvent arg0) {
						updateText();
					}

					@Override
					public void insertUpdate(DocumentEvent arg0) {
						updateText();
					}

					@Override
					public void removeUpdate(DocumentEvent arg0) {
						updateText();
					}
					
					public void updateText(){
						text.setText(textHolder.getText());
						refreshCanvas();
					}
					
				});
				textCustomization.add(textHolder);
				
				//Panel to hold customization options
				JPanel options = new JPanel();
				options.setOpaque(false);
				options.setLayout(new GridLayout(1, 4));
				textCustomization.add(options);
				
				options.add(new JLabel());
				
				//Font option
				final JLabel font = new JLabel();
				font.setIcon(new ImageIcon(Toolkit.getDefaultToolkit().createImage("Resources/Images/Icons/font.png").getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
				font.setToolTipText("Change the font settings of text.");
				font.addMouseListener(new MouseListener(){

					@Override
					public void mouseClicked(MouseEvent arg0) {
						if(preview.getSelectedIndex() == 0){
							getFontChooser().setSelectedFont(textHolder.getFont());
							int response = getFontChooser().showDialog(null);
							if(response == JFontChooser.OK_OPTION){
								text.setFont(getFontChooser().getSelectedFont());
								textHolder.setFont(getFontChooser().getSelectedFont());
							}
							refreshCanvas();
							refreshEditHistory();
						}
					}

					@Override
					public void mouseEntered(MouseEvent arg0) {
						if(preview.getSelectedIndex() == 0){
							font.setIcon(new ImageIcon(Toolkit.getDefaultToolkit().createImage("Resources/Images/Icons/font_hover.png").getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
							textHolder.setBorder(BorderFactory.createLineBorder(SystemColor.LIGHT_GRAY, 5));
							textCustomization.setBackground(Color.LIGHT_GRAY);
						}
					}

					@Override
					public void mouseExited(MouseEvent arg0) {
						font.setIcon(new ImageIcon(Toolkit.getDefaultToolkit().createImage("Resources/Images/Icons/font.png").getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
						textHolder.setBorder(BorderFactory.createLineBorder(SystemColor.GRAY, 5));
						textCustomization.setBackground(Color.GRAY);
					}

					@Override
					public void mousePressed(MouseEvent arg0) {
						// TODO Auto-generated method stub
						
					}

					@Override
					public void mouseReleased(MouseEvent arg0) {
						// TODO Auto-generated method stub
						
					}
					
				});
				options.add(font);
				
				//Move option
				final JLabel move = new JLabel();
				move.setIcon(new ImageIcon(Toolkit.getDefaultToolkit().createImage("Resources/Images/Icons/move.png").getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
				move.setToolTipText("Click and select new position in preview.");
				move.addMouseListener(new MouseListener(){

					@Override
					public void mouseClicked(MouseEvent e) {
						if(preview.getSelectedIndex() == 0){
							moveFrontTextCustomization = true;
							textCustomizationToMove = text;
							refreshEditHistory();
							moveClicked();
						}
					}

					@Override
					public void mouseEntered(MouseEvent e) {
						if(preview.getSelectedIndex() == 0){
							move.setIcon(new ImageIcon(Toolkit.getDefaultToolkit().createImage("Resources/Images/Icons/move_hover.png").getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
							textHolder.setBorder(BorderFactory.createLineBorder(SystemColor.LIGHT_GRAY, 5));
							textCustomization.setBackground(Color.LIGHT_GRAY);
						}
					}

					@Override
					public void mouseExited(MouseEvent e) {
						move.setIcon(new ImageIcon(Toolkit.getDefaultToolkit().createImage("Resources/Images/Icons/move.png").getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
						textHolder.setBorder(BorderFactory.createLineBorder(SystemColor.GRAY, 5));
						textCustomization.setBackground(Color.GRAY);
					}

					@Override
					public void mousePressed(MouseEvent e) {
						// TODO Auto-generated method stub
						
					}

					@Override
					public void mouseReleased(MouseEvent e) {
						// TODO Auto-generated method stub
						
					}
					
				});
				options.add(move);

				JLabel delete = new JLabel("x");
				delete.setForeground(Color.WHITE);
				delete.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 15));
				delete.setToolTipText("Deletes the design.");
				delete.addMouseListener(new MouseListener(){

					@Override
					public void mouseClicked(MouseEvent arg0) {
						if(preview.getSelectedIndex() == 0){
							frontTextCustomizationsArr.remove(text);
							refreshEditHistory();
							refreshCanvas();
						}
					}

					@Override
					public void mouseEntered(MouseEvent arg0) {
						if(preview.getSelectedIndex() == 0){
							((JLabel)arg0.getSource()).setForeground(Color.RED);
							textHolder.setBorder(BorderFactory.createLineBorder(SystemColor.LIGHT_GRAY, 5));
							textCustomization.setBackground(Color.LIGHT_GRAY);
						}
					}

					@Override
					public void mouseExited(MouseEvent arg0) {
						((JLabel)arg0.getSource()).setForeground(Color.WHITE);
						textHolder.setBorder(BorderFactory.createLineBorder(SystemColor.GRAY, 5));
						textCustomization.setBackground(Color.GRAY);
					}

					@Override
					public void mousePressed(MouseEvent arg0) {
						// TODO Auto-generated method stub
						
					}

					@Override
					public void mouseReleased(MouseEvent arg0) {
						// TODO Auto-generated method stub
						
					}
					
				});
				options.add(delete);

				frontCustomizations.add(textCustomization);
			}
			
			for(int i = 1; i < noFrontCustomizations; i++){
				
				//Panel for each customization
				final int index = i;
				
				final JPanel customization = new JPanel();
				customization.setLayout(new GridLayout(1, 2));
				customization.setBackground(Color.GRAY);
				customization.setBorder(BorderFactory.createMatteBorder(3, 3, 3, 3, Color.DARK_GRAY));
				customization.setPreferredSize(new Dimension(230, 50));
				customization.addMouseListener(new MouseListener(){

					@Override
					public void mouseClicked(MouseEvent e) {
						// TODO Auto-generated method stub
						
					}

					@Override
					public void mouseEntered(MouseEvent e) {
						customization.setBackground(Color.LIGHT_GRAY);
						
					}

					@Override
					public void mouseExited(MouseEvent e) {
						customization.setBackground(Color.GRAY);
						
					}

					@Override
					public void mousePressed(MouseEvent e) {
						// TODO Auto-generated method stub
						
					}

					@Override
					public void mouseReleased(MouseEvent e) {
						// TODO Auto-generated method stub
						
					}
					
				});
				
				//Get customization icon
				final Shop_Customization_PictureSettings customizationIcon = frontCustomizationsArr.get(i);
				
				//Label for image icon
				JLabel icon = new JLabel();
				icon.setIcon(new ImageIcon(customizationIcon.getDesign().getScaledInstance(50, 50, Image.SCALE_DEFAULT)));
				customization.add(icon);
				
				//Panel to hold customization options
				JPanel options = new JPanel();
				options.setOpaque(false);
				options.setLayout(new GridLayout(1, 4));
				customization.add(options);
				
				//Move option
				final JLabel move = new JLabel();
				move.setIcon(new ImageIcon(Toolkit.getDefaultToolkit().createImage("Resources/Images/Icons/move.png").getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
				move.setToolTipText("Click and select new position in preview.");
				move.addMouseListener(new MouseListener(){

					@Override
					public void mouseClicked(MouseEvent e) {
						if(preview.getSelectedIndex() == 0){
							moveFrontCustomization = true;
							customizationToMove = frontCustomizationsArr.get(index);
							refreshEditHistory();
							moveClicked();
						}
					}

					@Override
					public void mouseEntered(MouseEvent e) {
						if(preview.getSelectedIndex() == 0){
							move.setIcon(new ImageIcon(Toolkit.getDefaultToolkit().createImage("Resources/Images/Icons/move_hover.png").getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
							customization.setBackground(Color.LIGHT_GRAY);
						}
					}

					@Override
					public void mouseExited(MouseEvent e) {
						move.setIcon(new ImageIcon(Toolkit.getDefaultToolkit().createImage("Resources/Images/Icons/move.png").getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
						customization.setBackground(Color.GRAY);
					}

					@Override
					public void mousePressed(MouseEvent e) {
						// TODO Auto-generated method stub
						
					}

					@Override
					public void mouseReleased(MouseEvent e) {
						// TODO Auto-generated method stub
						
					}
					
				});
				options.add(move);

				JLabel upsize = new JLabel("+");
				upsize.setForeground(Color.WHITE);
				upsize.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 15));
				upsize.setToolTipText("Increase the design size.");
				upsize.addMouseListener(new MouseListener(){

					@Override
					public void mouseClicked(MouseEvent e) {
						if(frontCustomizationsArr.get(index).getWidth() * 1.1 <= 200 && preview.getSelectedIndex() == 0){
							frontCustomizationsArr.get(index).setWidth((int)(frontCustomizationsArr.get(index).getWidth() * 1.1));
							frontCustomizationsArr.get(index).setHeight((int)(frontCustomizationsArr.get(index).getHeight() * 1.1));
							refreshEditHistory();
							
							frontView.repaint();
						}
						else{
							
						}
						
					}

					@Override
					public void mouseEntered(MouseEvent e) {
						if(preview.getSelectedIndex() == 0)
							((JLabel)e.getSource()).setForeground(Color.RED);
							customization.setBackground(Color.LIGHT_GRAY);
						
					}

					@Override
					public void mouseExited(MouseEvent e) {
						if(preview.getSelectedIndex() == 0)
							((JLabel)e.getSource()).setForeground(Color.WHITE);
							customization.setBackground(Color.GRAY);
						
					}

					@Override
					public void mousePressed(MouseEvent e) {
						// TODO Auto-generated method stub
						
					}

					@Override
					public void mouseReleased(MouseEvent e) {
						// TODO Auto-generated method stub
						
					}
					
				});
				options.add(upsize);

				JLabel downsize = new JLabel("-");
				downsize.setForeground(Color.WHITE);
				downsize.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 15));
				downsize.setToolTipText("Decrease the design size.");
				downsize.addMouseListener(new MouseListener(){

					@Override
					public void mouseClicked(MouseEvent e) {
						if(frontCustomizationsArr.get(index).getWidth() * 0.9 >= 50 && preview.getSelectedIndex() == 0){
							frontCustomizationsArr.get(index).setWidth((int)(frontCustomizationsArr.get(index).getWidth() * 0.9));
							frontCustomizationsArr.get(index).setHeight((int)(frontCustomizationsArr.get(index).getHeight() * 0.9));
							refreshEditHistory();
							
							frontView.repaint();
						}
						else{
							
						}
						
					}

					@Override
					public void mouseEntered(MouseEvent e) {
						if(preview.getSelectedIndex() == 0)
							((JLabel)e.getSource()).setForeground(Color.RED);
						customization.setBackground(Color.LIGHT_GRAY);
						
					}

					@Override
					public void mouseExited(MouseEvent e) {
						if(preview.getSelectedIndex() == 0)
							((JLabel)e.getSource()).setForeground(Color.WHITE);
						customization.setBackground(Color.GRAY);
						
					}

					@Override
					public void mousePressed(MouseEvent e) {
						// TODO Auto-generated method stub
						
					}

					@Override
					public void mouseReleased(MouseEvent e) {
						// TODO Auto-generated method stub
						
					}
					
				});
				options.add(downsize);

				JLabel delete = new JLabel("x");
				delete.setForeground(Color.WHITE);
				delete.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 15));
				delete.setToolTipText("Deletes the design.");
				delete.addMouseListener(new MouseListener(){

					@Override
					public void mouseClicked(MouseEvent arg0) {
						if(preview.getSelectedIndex() == 0){
							frontCustomizationsArr.remove(frontCustomizationsArr.get(index));
							refreshEditHistory();
							refreshCanvas();
						}
					}

					@Override
					public void mouseEntered(MouseEvent arg0) {
						if(preview.getSelectedIndex() == 0)
							((JLabel)arg0.getSource()).setForeground(Color.RED);
						customization.setBackground(Color.LIGHT_GRAY);
						
					}

					@Override
					public void mouseExited(MouseEvent arg0) {
						if(preview.getSelectedIndex() == 0)
							((JLabel)arg0.getSource()).setForeground(Color.WHITE);
						customization.setBackground(Color.GRAY);
						
					}

					@Override
					public void mousePressed(MouseEvent arg0) {
						// TODO Auto-generated method stub
						
					}

					@Override
					public void mouseReleased(MouseEvent arg0) {
						// TODO Auto-generated method stub
						
					}
					
				});
				options.add(delete);

				frontCustomizations.add(customization);
				
			}
			

			frontEditsHistory = new JScrollPane(frontCustomizations);
			frontEditsHistory.setBorder(new MatteBorder(2, 2, 2, 2, (Color) UIManager.getColor("TabbedPane.shadow")));
			frontEditsHistory.setPreferredSize(new Dimension(300, 300));
			
		}
		return frontEditsHistory;
	}
	private JScrollPane getBackEditsHistory() {
		if(backEditsHistory == null){
			//Panel for back customizations
			final ArrayList <Shop_Customization_PictureSettings> backCustomizationArr = backView.getCustomizations();
			int noBackCustomizations = backCustomizationArr.size();
			
			final ArrayList <Shop_Customization_TextSettings> backTextCustomizationsArr = backView.getTextCustomizations();
			int noBackTextCustomizations = backTextCustomizationsArr.size();
			
			//Panel containing all front customizations
			JPanel backCustomizations = new JPanel();
			backCustomizations.setBackground(Color.DARK_GRAY);
			backCustomizations.setPreferredSize(new Dimension(230, ((noBackCustomizations - 1) * 57) + (noBackTextCustomizations * 57) + 15));
			
			JLabel header = new JLabel("Back History");
			header.setForeground(Color.LIGHT_GRAY);
			header.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 15));
			backCustomizations.add(header);
			
			//Generate front customizations
			for(int i = 0; i < noBackTextCustomizations; i++){
				//Panel for each customization
				final JPanel textCustomization = new JPanel();
				final JTextField textHolder = new JTextField();
				textCustomization.setLayout(new GridLayout(1, 3));
				textCustomization.setBackground(Color.GRAY);
				textCustomization.setBorder(BorderFactory.createMatteBorder(3, 3, 3, 3, Color.DARK_GRAY));
				textCustomization.setPreferredSize(new Dimension(230, 50));
				textCustomization.addMouseListener(new MouseListener(){

					@Override
					public void mouseClicked(MouseEvent e) {
						// TODO Auto-generated method stub
						
					}

					@Override
					public void mouseEntered(MouseEvent e) {
						if(preview.getSelectedIndex() == 0){
							textHolder.setBorder(BorderFactory.createLineBorder(SystemColor.LIGHT_GRAY, 5));
							textCustomization.setBackground(Color.LIGHT_GRAY);
						}
						
					}

					@Override
					public void mouseExited(MouseEvent e) {
						textHolder.setBorder(BorderFactory.createLineBorder(SystemColor.GRAY, 5));
						textCustomization.setBackground(Color.GRAY);
						
					}

					@Override
					public void mousePressed(MouseEvent e) {
						// TODO Auto-generated method stub
						
					}

					@Override
					public void mouseReleased(MouseEvent e) {
						// TODO Auto-generated method stub
						
					}
					
				});
				
				//Get text customization
				final Shop_Customization_TextSettings text = backTextCustomizationsArr.get(i);
				
				//Label for text
				textHolder.setText(text.getText());
				textHolder.setBorder(BorderFactory.createLineBorder(SystemColor.GRAY, 5));
				textHolder.setFont(text.getFont());
				textHolder.addMouseListener(new MouseListener(){

					@Override
					public void mouseClicked(MouseEvent arg0) {
						// TODO Auto-generated method stub
						
					}

					@Override
					public void mouseEntered(MouseEvent arg0) {
						if(preview.getSelectedIndex() == 1){
							textHolder.setEnabled(true);
							textHolder.setBorder(BorderFactory.createLineBorder(SystemColor.LIGHT_GRAY, 5));
							textCustomization.setBackground(Color.LIGHT_GRAY);
						}
						else
							textHolder.setEnabled(false);
					}

					@Override
					public void mouseExited(MouseEvent arg0) {
						textHolder.setBorder(BorderFactory.createLineBorder(SystemColor.GRAY, 5));
						textCustomization.setBackground(Color.GRAY);
					}

					@Override
					public void mousePressed(MouseEvent arg0) {
						// TODO Auto-generated method stub
						
					}

					@Override
					public void mouseReleased(MouseEvent arg0) {
						// TODO Auto-generated method stub
						
					}
					
				});
				textHolder.getDocument().addDocumentListener(new DocumentListener(){

					@Override
					public void changedUpdate(DocumentEvent arg0) {
						updateText();
					}

					@Override
					public void insertUpdate(DocumentEvent arg0) {
						updateText();
					}

					@Override
					public void removeUpdate(DocumentEvent arg0) {
						updateText();
					}
					
					public void updateText(){
						text.setText(textHolder.getText());
						refreshCanvas();
					}
					
				});
				textCustomization.add(textHolder);
				
				//Panel to hold customization options
				JPanel options = new JPanel();
				options.setOpaque(false);
				options.setLayout(new GridLayout(1, 4));
				textCustomization.add(options);
				
				options.add(new JLabel());
				
				//Font option
				final JLabel font = new JLabel();
				font.setIcon(new ImageIcon(Toolkit.getDefaultToolkit().createImage("Resources/Images/Icons/font.png").getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
				font.setToolTipText("Change the font settings of text.");
				font.addMouseListener(new MouseListener(){

					@Override
					public void mouseClicked(MouseEvent arg0) {
						if(preview.getSelectedIndex() == 1){
							getFontChooser().setSelectedFont(textHolder.getFont());
							int response = getFontChooser().showDialog(null);
							if(response == JFontChooser.OK_OPTION){
								text.setFont(getFontChooser().getSelectedFont());
								textHolder.setFont(getFontChooser().getSelectedFont());
							}
							refreshCanvas();
							refreshEditHistory();
						}
					}

					@Override
					public void mouseEntered(MouseEvent arg0) {
						if(preview.getSelectedIndex() == 1){
							font.setIcon(new ImageIcon(Toolkit.getDefaultToolkit().createImage("Resources/Images/Icons/font_hover.png").getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
							textHolder.setBorder(BorderFactory.createLineBorder(SystemColor.LIGHT_GRAY, 5));
							textCustomization.setBackground(Color.LIGHT_GRAY);
						}
					}

					@Override
					public void mouseExited(MouseEvent arg0) {
						font.setIcon(new ImageIcon(Toolkit.getDefaultToolkit().createImage("Resources/Images/Icons/font.png").getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
						textHolder.setBorder(BorderFactory.createLineBorder(SystemColor.GRAY, 5));
						textCustomization.setBackground(Color.GRAY);
					}

					@Override
					public void mousePressed(MouseEvent arg0) {
						// TODO Auto-generated method stub
						
					}

					@Override
					public void mouseReleased(MouseEvent arg0) {
						// TODO Auto-generated method stub
						
					}
					
				});
				options.add(font);
				
				//Move option
				final JLabel move = new JLabel();
				move.setIcon(new ImageIcon(Toolkit.getDefaultToolkit().createImage("Resources/Images/Icons/move.png").getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
				move.setToolTipText("Click and select new position in preview.");
				move.addMouseListener(new MouseListener(){

					@Override
					public void mouseClicked(MouseEvent e) {
						if(preview.getSelectedIndex() == 1){
							moveBackTextCustomization = true;
							textCustomizationToMove = text;
							refreshEditHistory();
							moveClicked();
						}
					}

					@Override
					public void mouseEntered(MouseEvent e) {
						if(preview.getSelectedIndex() == 1){
							move.setIcon(new ImageIcon(Toolkit.getDefaultToolkit().createImage("Resources/Images/Icons/move_hover.png").getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
							textHolder.setBorder(BorderFactory.createLineBorder(SystemColor.LIGHT_GRAY, 5));
							textCustomization.setBackground(Color.LIGHT_GRAY);
						}
					}

					@Override
					public void mouseExited(MouseEvent e) {
						move.setIcon(new ImageIcon(Toolkit.getDefaultToolkit().createImage("Resources/Images/Icons/move.png").getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
						textHolder.setBorder(BorderFactory.createLineBorder(SystemColor.GRAY, 5));
						textCustomization.setBackground(Color.GRAY);
						
					}

					@Override
					public void mousePressed(MouseEvent e) {
						// TODO Auto-generated method stub
						
					}

					@Override
					public void mouseReleased(MouseEvent e) {
						// TODO Auto-generated method stub
						
					}
					
				});
				options.add(move);

				JLabel delete = new JLabel("x");
				delete.setForeground(Color.WHITE);
				delete.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 15));
				delete.setToolTipText("Deletes the design.");
				delete.addMouseListener(new MouseListener(){

					@Override
					public void mouseClicked(MouseEvent arg0) {
						if(preview.getSelectedIndex() == 1){
							backTextCustomizationsArr.remove(text);
							refreshEditHistory();
							refreshCanvas();
						}
					}

					@Override
					public void mouseEntered(MouseEvent arg0) {
						if(preview.getSelectedIndex() == 1)
							((JLabel)arg0.getSource()).setForeground(Color.RED);
						textHolder.setBorder(BorderFactory.createLineBorder(SystemColor.LIGHT_GRAY, 5));
						textCustomization.setBackground(Color.LIGHT_GRAY);
						
					}

					@Override
					public void mouseExited(MouseEvent arg0) {
						if(preview.getSelectedIndex() == 1)
							((JLabel)arg0.getSource()).setForeground(Color.WHITE);
						textHolder.setBorder(BorderFactory.createLineBorder(SystemColor.GRAY, 5));
						textCustomization.setBackground(Color.GRAY);
						
					}

					@Override
					public void mousePressed(MouseEvent arg0) {
						// TODO Auto-generated method stub
						
					}

					@Override
					public void mouseReleased(MouseEvent arg0) {
						// TODO Auto-generated method stub
						
					}
					
				});
				options.add(delete);

				backCustomizations.add(textCustomization);
			}
			
			for(int i = 1; i < noBackCustomizations; i++){
				
				//Panel for each customization
				final int index = i;
				final JPanel customization = new JPanel();
				customization.setLayout(new GridLayout(1, 2));
				customization.setBackground(Color.GRAY);
				customization.setBorder(BorderFactory.createMatteBorder(3, 3, 3, 3, Color.DARK_GRAY));
				customization.setPreferredSize(new Dimension(230, 50));
				customization.addMouseListener(new MouseListener(){

					@Override
					public void mouseClicked(MouseEvent e) {
						// TODO Auto-generated method stub
						
					}

					@Override
					public void mouseEntered(MouseEvent e) {
						customization.setBackground(Color.LIGHT_GRAY);
						
					}

					@Override
					public void mouseExited(MouseEvent e) {
						customization.setBackground(Color.GRAY);
						
					}

					@Override
					public void mousePressed(MouseEvent e) {
						// TODO Auto-generated method stub
						
					}

					@Override
					public void mouseReleased(MouseEvent e) {
						// TODO Auto-generated method stub
						
					}
					
				});
				
				//Get customization icon
				final Shop_Customization_PictureSettings customizationIcon = backCustomizationArr.get(i);
				
				//Label for image icon
				JLabel icon = new JLabel();
				icon.setIcon(new ImageIcon(customizationIcon.getDesign().getScaledInstance(50, 50, Image.SCALE_DEFAULT)));
				customization.add(icon);
				
				//Panel to hold customization options
				JPanel options = new JPanel();
				options.setOpaque(false);
				options.setLayout(new GridLayout(1, 4));
				customization.add(options);
				
				//Move option
				final JLabel move = new JLabel();
				move.setIcon(new ImageIcon(Toolkit.getDefaultToolkit().createImage("Resources/Images/Icons/move.png").getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
				move.setToolTipText("Click and select new position in preview.");
				move.addMouseListener(new MouseListener(){
	
					@Override
					public void mouseClicked(MouseEvent e) {
						if(preview.getSelectedIndex() == 1){
							moveBackCustomization = true;
							customizationToMove = backCustomizationArr.get(index);
							refreshEditHistory();
							moveClicked();
						}
					}
	
					@Override
					public void mouseEntered(MouseEvent e) {
						if(preview.getSelectedIndex() == 1){
							move.setIcon(new ImageIcon(Toolkit.getDefaultToolkit().createImage("Resources/Images/Icons/move_hover.png").getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
							customization.setBackground(Color.LIGHT_GRAY);
						}
					}
	
					@Override
					public void mouseExited(MouseEvent e) {
						move.setIcon(new ImageIcon(Toolkit.getDefaultToolkit().createImage("Resources/Images/Icons/move.png").getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
						customization.setBackground(Color.GRAY);
						
					}
	
					@Override
					public void mousePressed(MouseEvent e) {
						// TODO Auto-generated method stub
						
					}
	
					@Override
					public void mouseReleased(MouseEvent e) {
						// TODO Auto-generated method stub
						
					}
					
				});
				options.add(move);
	
				JLabel upsize = new JLabel("+");
				upsize.setForeground(Color.WHITE);
				upsize.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 15));
				upsize.setToolTipText("Increase the design size.");
				upsize.addMouseListener(new MouseListener(){
	
					@Override
					public void mouseClicked(MouseEvent e) {
						if(backCustomizationArr.get(index).getWidth() * 1.1 <= 200 && preview.getSelectedIndex() == 1){
							backCustomizationArr.get(index).setWidth((int)(backCustomizationArr.get(index).getWidth() * 1.1));
							backCustomizationArr.get(index).setHeight((int)(backCustomizationArr.get(index).getHeight() * 1.1));
							refreshEditHistory();
							
							backView.repaint();
						}
						else{
							
						}
						
					}
	
					@Override
					public void mouseEntered(MouseEvent e) {
						if(preview.getSelectedIndex() == 1)
							((JLabel)e.getSource()).setForeground(Color.RED);
						customization.setBackground(Color.LIGHT_GRAY);
						
					}
	
					@Override
					public void mouseExited(MouseEvent e) {
						if(preview.getSelectedIndex() == 1)
							((JLabel)e.getSource()).setForeground(Color.WHITE);
						customization.setBackground(Color.GRAY);
						
					}
	
					@Override
					public void mousePressed(MouseEvent e) {
						// TODO Auto-generated method stub
						
					}
	
					@Override
					public void mouseReleased(MouseEvent e) {
						// TODO Auto-generated method stub
						
					}
					
				});
				options.add(upsize);
	
				JLabel downsize = new JLabel("-");
				downsize.setForeground(Color.WHITE);
				downsize.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 15));
				downsize.setToolTipText("Decrease the design size.");
				downsize.addMouseListener(new MouseListener(){
	
					@Override
					public void mouseClicked(MouseEvent e) {
						if(backCustomizationArr.get(index).getWidth() * 0.9 >= 50 && preview.getSelectedIndex() == 1){
							backCustomizationArr.get(index).setWidth((int)(backCustomizationArr.get(index).getWidth() * 0.9));
							backCustomizationArr.get(index).setHeight((int)(backCustomizationArr.get(index).getHeight() * 0.9));
							refreshEditHistory();
							
							backView.repaint();
						}
						else{
							
						}
						
					}
	
					@Override
					public void mouseEntered(MouseEvent e) {
						if(preview.getSelectedIndex() == 1)
							((JLabel)e.getSource()).setForeground(Color.RED);
						customization.setBackground(Color.LIGHT_GRAY);
						
					}
	
					@Override
					public void mouseExited(MouseEvent e) {
						if(preview.getSelectedIndex() == 1)
							((JLabel)e.getSource()).setForeground(Color.WHITE);
						customization.setBackground(Color.GRAY);
						
					}
	
					@Override
					public void mousePressed(MouseEvent e) {
						// TODO Auto-generated method stub
						
					}
	
					@Override
					public void mouseReleased(MouseEvent e) {
						// TODO Auto-generated method stub
						
					}
					
				});
				options.add(downsize);
	
				JLabel delete = new JLabel("x");
				delete.setForeground(Color.WHITE);
				delete.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 15));
				delete.setToolTipText("Deletes the design.");
				delete.addMouseListener(new MouseListener(){
	
					@Override
					public void mouseClicked(MouseEvent arg0) {
						if(preview.getSelectedIndex() == 1){
							backCustomizationArr.remove(backCustomizationArr.get(index));
							refreshEditHistory();
							refreshCanvas();
						}
					}
	
					@Override
					public void mouseEntered(MouseEvent arg0) {
						if(preview.getSelectedIndex() == 1)
							((JLabel)arg0.getSource()).setForeground(Color.RED);
						customization.setBackground(Color.LIGHT_GRAY);
						
					}
	
					@Override
					public void mouseExited(MouseEvent arg0) {
						if(preview.getSelectedIndex() == 1)
							((JLabel)arg0.getSource()).setForeground(Color.WHITE);
						customization.setBackground(Color.GRAY);
						
					}
	
					@Override
					public void mousePressed(MouseEvent arg0) {
						// TODO Auto-generated method stub
						
					}
	
					@Override
					public void mouseReleased(MouseEvent arg0) {
						// TODO Auto-generated method stub
						
					}
					
				});
				options.add(delete);
	
				backCustomizations.add(customization);
				
			}
			
			backEditsHistory = new JScrollPane(backCustomizations);
			backEditsHistory.setBorder(new MatteBorder(2, 2, 2, 2, (Color) UIManager.getColor("TabbedPane.shadow")));
			backEditsHistory.setPreferredSize(new Dimension(300, 300));
			
		}
		return backEditsHistory;
	}
	public Shop_Customization_Canvas getFrontView() {
		if (frontView == null) {
			boolean front = true;
			frontView = new Shop_Customization_Canvas(front);
			frontView.setOpaque(false);
			frontView.addMouseListener(new MouseAdapter() {
				@Override
				public void mouseExited(MouseEvent e) {
					refreshEditHistory();
				}
				@Override
				public void mouseClicked(MouseEvent arg0) {
					refreshEditHistory();
				}
			});
			frontView.setPreferredSize(new Dimension(420, 550));
			
			//Setting of default images to canvas
			defaultProductFrontImage = Toolkit.getDefaultToolkit().getImage(product.getFrontImageUrl());
			defaultProductFront = new Shop_Customization_PictureSettings(defaultProductFrontImage, 0, 0, 420,550);
			frontView.addCustomization(defaultProductFront);
			
		}
		return frontView;
	}
	public Shop_Customization_Canvas getBackView() {
		if (backView == null) {
			boolean front = false;
			backView = new Shop_Customization_Canvas(front);
			backView.setOpaque(false);
			backView.addMouseListener(new MouseAdapter() {
				@Override
				public void mouseExited(MouseEvent e) {
					refreshEditHistory();
				}
			});
			backView.addMouseListener(new MouseAdapter() {
				@Override
				public void mouseClicked(MouseEvent e) {
					refreshEditHistory();
				}
			});
			backView.setPreferredSize(new Dimension(420, 550));
			
			//Setting of default images to canvas
			defaultProductBackImage = Toolkit.getDefaultToolkit().getImage(product.getBackImageUrl());
			defaultProductBack = new Shop_Customization_PictureSettings(defaultProductBackImage, 0, 0, 420, 550);
			backView.addCustomization(defaultProductBack);
		}
		return backView;
	}
	private JPanel getFrontHolder() {
		if (frontHolder == null) {
			frontHolder = new JPanel();
			frontHolder.setBackground(Color.DARK_GRAY);
			frontHolder.add(getFrontView());
		}
		return frontHolder;
	}
	private JPanel getBackHolder() {
		if (backHolder == null) {
			backHolder = new JPanel();
			backHolder.setBackground(Color.DARK_GRAY);
			backHolder.add(getBackView());
		}
		return backHolder;
	}
	private JLabel getBtnConfirm() {
		if (btnConfirm == null) {
			btnConfirm = new JLabel("Confirm");
			btnConfirm.setFont(new Font("Tahoma", Font.PLAIN, 20));
			btnConfirm.setForeground(Color.WHITE);
			btnConfirm.setOpaque(true);
			btnConfirm.setBackground(Color.DARK_GRAY);
			btnConfirm.setHorizontalTextPosition(SwingConstants.CENTER);
			btnConfirm.setHorizontalAlignment(SwingConstants.CENTER);

			final Shop_Customization_Form parser = this;
			
			btnConfirm.addMouseListener(new MouseListener(){

				@Override
				public void mouseClicked(MouseEvent arg0) {
					int response = JOptionPane.showConfirmDialog(parser, "If you're done with your customization, please select \"YES\".\nOnce done you can no longer edit your customizations.", "Confirm customization", JOptionPane.YES_NO_OPTION);
					if(response == JOptionPane.YES_OPTION){
						getControl().saveCustomization(parser);
						if(getParser() != null){
							getParser().getControl().viewCart();
							parser.getParser().getParser().displayMessage(true, "Successfully added to shopping cart.");
						}
						else{
							getSecondaryParser().getControl().viewCart();
							parser.getSecondaryParser().getParser().displayMessage(true, "Successfully added to shopping cart.");
						}
						formForDispose.dispose();
					}
				}

				@Override
				public void mouseEntered(MouseEvent arg0) {
					btnConfirm.setBackground(Color.LIGHT_GRAY);
				}

				@Override
				public void mouseExited(MouseEvent arg0) {
					btnConfirm.setBackground(Color.DARK_GRAY);
				}

				@Override
				public void mousePressed(MouseEvent arg0) {
					// TODO Auto-generated method stub
					
				}

				@Override
				public void mouseReleased(MouseEvent arg0) {
					// TODO Auto-generated method stub
					
				}
			
			});
		}
		return btnConfirm;
	}
	private JLabel getBtnReset() {
		if (btnReset == null) {
			btnReset = new JLabel("Reset");
			btnReset.setFont(new Font("Tahoma", Font.PLAIN, 20));
			btnReset.setForeground(Color.WHITE);
			btnReset.setOpaque(true);
			btnReset.setBackground(Color.DARK_GRAY);
			btnReset.setHorizontalTextPosition(SwingConstants.CENTER);
			btnReset.setHorizontalAlignment(SwingConstants.CENTER);
			
			btnReset.addMouseListener(new MouseListener(){

				@Override
				public void mouseClicked(MouseEvent arg0) {
					frontView.getCustomizations().clear();
					frontView.getTextCustomizations().clear();
					frontView.addCustomization(defaultProductFront);
					
					backView.getCustomizations().clear();
					backView.getTextCustomizations().clear();
					backView.addCustomization(defaultProductBack);
					
					moveFrontCustomization = false;
					moveFrontTextCustomization = false;
					moveBackCustomization = false;
					moveBackTextCustomization = false;
					customizationToMove = null;
					textCustomizationToMove = null;
					
					refreshCanvas();
					refreshEditHistory();
				}

				@Override
				public void mouseEntered(MouseEvent arg0) {
					btnReset.setBackground(Color.LIGHT_GRAY);
				}

				@Override
				public void mouseExited(MouseEvent arg0) {
					btnReset.setBackground(Color.DARK_GRAY);
				}

				@Override
				public void mousePressed(MouseEvent arg0) {
					// TODO Auto-generated method stub
					
				}

				@Override
				public void mouseReleased(MouseEvent arg0) {
					// TODO Auto-generated method stub
					
				}
			
			});
		}
		return btnReset;
	}
	private JPanel getPanelForConfirm() {
		if (panelForConfirm == null) {
			panelForConfirm = new JPanel();
			panelForConfirm.setOpaque(false);
			GridBagLayout gbl_panelForConfirm = new GridBagLayout();
			gbl_panelForConfirm.columnWidths = new int[]{194, 0};
			gbl_panelForConfirm.rowHeights = new int[]{85, 0};
			gbl_panelForConfirm.columnWeights = new double[]{0.0, Double.MIN_VALUE};
			gbl_panelForConfirm.rowWeights = new double[]{0.0, Double.MIN_VALUE};
			panelForConfirm.setLayout(gbl_panelForConfirm);
			GridBagConstraints gbc_btnConfirm = new GridBagConstraints();
			gbc_btnConfirm.ipady = 20;
			gbc_btnConfirm.ipadx = 20;
			gbc_btnConfirm.insets = new Insets(50, 50, 50, 50);
			gbc_btnConfirm.weighty = 0.5;
			gbc_btnConfirm.weightx = 0.5;
			gbc_btnConfirm.fill = GridBagConstraints.BOTH;
			gbc_btnConfirm.gridx = 0;
			gbc_btnConfirm.gridy = 0;
			panelForConfirm.add(getBtnConfirm(), gbc_btnConfirm);
		}
		return panelForConfirm;
	}
	private JPanel getPanelForReset() {
		if (panelForReset == null) {
			panelForReset = new JPanel();
			panelForReset.setOpaque(false);
			GridBagLayout gbl_panelForReset = new GridBagLayout();
			gbl_panelForReset.columnWidths = new int[]{175, 0};
			gbl_panelForReset.rowHeights = new int[]{85, 0};
			gbl_panelForReset.columnWeights = new double[]{1.0, Double.MIN_VALUE};
			gbl_panelForReset.rowWeights = new double[]{0.0, Double.MIN_VALUE};
			panelForReset.setLayout(gbl_panelForReset);
			GridBagConstraints gbc_btnReset = new GridBagConstraints();
			gbc_btnReset.ipady = 20;
			gbc_btnReset.ipadx = 20;
			gbc_btnReset.insets = new Insets(50, 50, 50, 50);
			gbc_btnReset.weighty = 1.0;
			gbc_btnReset.weightx = 1.0;
			gbc_btnReset.fill = GridBagConstraints.BOTH;
			gbc_btnReset.gridx = 0;
			gbc_btnReset.gridy = 0;
			panelForReset.add(getBtnReset(), gbc_btnReset);
		}
		return panelForReset;
	}
	private JLabel getLblText() {
		if (lblText == null) {
			lblText = new JLabel("Text: ");
			lblText.setForeground(Color.LIGHT_GRAY);
			lblText.setHorizontalAlignment(SwingConstants.RIGHT);
		}
		return lblText;
	}

	public JFontChooser getFontChooser() {
		if(fontChooser == null){
			fontChooser = new JFontChooser();
		}
		return fontChooser;
	}
	private JButton getBtnFont() {
		if (btnFont == null) {
			btnFont = new JButton("font...");
			btnFont.addMouseListener(new MouseAdapter() {
				@Override
				public void mouseClicked(MouseEvent arg0) {
					getFontChooser().setSelectedFont(getTextArea().getFont());
					int result = getFontChooser().showDialog(null);
					if(result == JFontChooser.OK_OPTION){
						getTextArea().setFont(getFontChooser().getSelectedFont());
					}
				}
			});
		}
		return btnFont;
	}
	private JScrollPane getScrollPane() {
		if (scrollPane == null) {
			scrollPane = new JScrollPane();
			scrollPane.setViewportView(getTextArea());
		}
		return scrollPane;
	}
	private JTextArea getTextArea() {
		if (textArea == null) {
			textArea = new JTextArea();
			textArea.setFont(new Font("Arial", Font.PLAIN, 10));
			textArea.getDocument().addDocumentListener(new DocumentListener(){

				@Override
				public void changedUpdate(DocumentEvent arg0) {
					toggleAddTextButton();
				}

				@Override
				public void insertUpdate(DocumentEvent arg0) {
					toggleAddTextButton();
				}

				@Override
				public void removeUpdate(DocumentEvent arg0) {
					toggleAddTextButton();
				}
				
				public void toggleAddTextButton(){
					if(textArea.getText().isEmpty()){
						getAddTextToCanvas().setEnabled(false);
					}
					else{
						getAddTextToCanvas().setEnabled(true);
					}
				}
				
			});
			textArea.setLineWrap(true);
		}
		return textArea;
	}
	private JLabel getLblCustomImage() {
		if (lblCustomImage == null) {
			lblCustomImage = new JLabel("Image: ");
			lblCustomImage.setForeground(Color.LIGHT_GRAY);
		}
		return lblCustomImage;
	}
	private JButton getBtnUploadImage() {
		if (btnUploadImage == null) {
			btnUploadImage = new JButton("Upload");
			btnUploadImage.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent arg0) {
					int response = getFileChooser().showOpenDialog(parser.getParser());
					if(response == JFileChooser.APPROVE_OPTION){
						customImage = Toolkit.getDefaultToolkit().createImage(getFileChooser().getSelectedFile().getAbsolutePath());
						customImageDesign.setIcon(new ImageIcon(customImage.getScaledInstance(100, 100, Image.SCALE_DEFAULT)));
						getAddImageToCanvas().setEnabled(true);
					}
				}
			});
		}
		return btnUploadImage;
	}

	public JFileChooser getFileChooser() {
		if(fileChooser == null){
			fileChooser = new JFileChooser();
		}
		return fileChooser;
	}
	
	private JLabel getCustomImageDesign() {
		if (customImageDesign == null) {
			customImageDesign = new JLabel();
			customImage =  Toolkit.getDefaultToolkit().createImage(new File("Resources/Images/Default/no_image.jpg").getAbsolutePath());
			customImageDesign.setIcon(new ImageIcon(customImage.getScaledInstance(100, 100, Image.SCALE_DEFAULT)));
		}
		return customImageDesign;
	}
	private JButton getAddImageToCanvas() {
		if (addImageToCanvas == null) {
			addImageToCanvas = new JButton("Add");
			addImageToCanvas.addMouseListener(new MouseAdapter() {
				@Override
				public void mouseClicked(MouseEvent arg0) {
					setCustomDesign(new Shop_Customization_PictureSettings(customImage, 420, 550));
					if(getPreview().getSelectedIndex() == 0){
						frontView.addCustomization(getCustomDesign());
						refreshCanvas();
						refreshEditHistory();
					}
					else{
						backView.addCustomization(getCustomDesign());
						refreshCanvas();
						refreshEditHistory();
					}
				}
			});
			addImageToCanvas.setEnabled(false);
		}
		return addImageToCanvas;
	}
	private JButton getAddTextToCanvas() {
		if (addTextToCanvas == null) {
			addTextToCanvas = new JButton("Add");
			addTextToCanvas.setEnabled(false);
			addTextToCanvas.addMouseListener(new MouseAdapter() {
				@Override
				public void mouseClicked(MouseEvent e) {
					if(getPreview().getSelectedIndex() == 0){
						Shop_Customization_TextSettings text = new Shop_Customization_TextSettings(getTextArea().getText(), getTextArea().getFont());
						frontView.addTextCustomization(text);
						refreshCanvas();
						refreshEditHistory();
					}
					else{
						Shop_Customization_TextSettings text = new Shop_Customization_TextSettings(getTextArea().getText(), getTextArea().getFont());
						backView.addTextCustomization(text);
						refreshCanvas();
						refreshEditHistory();
					}
				}
			});
		}
		return addTextToCanvas;
	}
	private JLabel getLblCatalog() {
		if (lblCatalog == null) {
			lblCatalog = new JLabel();
			lblCatalog.setForeground(Color.LIGHT_GRAY);
			product.getCatalog().getCatalogDetailsById();
			lblCatalog.setText(product.getCatalog().getName());
			lblCatalog.setFont(new Font("Tahoma", Font.PLAIN, 26));
		}
		return lblCatalog;
	}
	private JLabel getLblProdname() {
		if (lblProdname == null) {
			lblProdname = new JLabel();
			lblProdname.setForeground(Color.BLACK);
			lblProdname.setText(product.getName());
			lblProdname.setFont(new Font("Segoe UI", Font.PLAIN, 24));
			lblProdname.setOpaque(true);
			lblProdname.setBackground(Color.WHITE);
		}
		return lblProdname;
	}
	private JTextArea getTxtrDescription() {
		if (txtrDescription == null) {
			txtrDescription = new JTextArea();
			txtrDescription.setLineWrap(true);
			txtrDescription.setEditable(false);
			txtrDescription.setText(product.getDescription());
		}
		return txtrDescription;
	}
	private JLabel getLblTotalPrice() {
		if (lblTotalPrice == null) {
			lblTotalPrice = new JLabel("Total Price");
			lblTotalPrice.setOpaque(true);
			lblTotalPrice.setBackground(Color.WHITE);
			lblTotalPrice.setHorizontalAlignment(SwingConstants.CENTER);
			lblTotalPrice.setFont(new Font("Tahoma", Font.PLAIN, 20));
		}
		return lblTotalPrice;
	}
	private JLabel getLblPrice() {
		if (lblPrice == null) {
			lblPrice = new JLabel();
			lblPrice.setText("$"+product.getUnitPrice());
			lblPrice.setFont(new Font("Segoe UI", Font.PLAIN, 40));
			lblPrice.setOpaque(true);
			lblPrice.setBackground(Color.WHITE);
			lblPrice.setHorizontalAlignment(SwingConstants.CENTER);
		}
		return lblPrice;
	}
	public JSpinner getQuantity() {
		if (quantity == null) {
			quantity = new JSpinner();
			quantity.setFont(new Font("Tahoma", Font.PLAIN, 66));
			quantity.setModel(new SpinnerNumberModel(1, 1, 10, 1));
			quantity.addChangeListener(new ChangeListener(){

				@Override
				public void stateChanged(ChangeEvent arg0) {
					lblPrice.setText("$" + Double.toString((double)(Integer)quantity.getValue() * product.getUnitPrice()));
				}
				
			});
		}
		return quantity;
	}
	public JLabel getLblQuantity() {
		if (lblQuantity == null) {
			lblQuantity = new JLabel("Quantity");
			lblQuantity.setOpaque(true);
			lblQuantity.setBackground(Color.WHITE);
			lblQuantity.setHorizontalAlignment(SwingConstants.CENTER);
			lblQuantity.setVerticalAlignment(SwingConstants.CENTER);
			lblQuantity.setFont(new Font("Tahoma", Font.PLAIN, 20));
		}
		return lblQuantity;
	}
	
	public void moveClicked(){
		setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
	}
	
	public static void moveDone(){
		self.setCursor(Cursor.getDefaultCursor());
	}
}
